import React, { Component } from 'react'
import qs from 'querystring'
const DetailData = [
    { id: '01', content: '你好 中国' },
    { id: '02', content: '你好 重庆' },
    { id: '03', content: '你好 大足' },
]
export default class index extends Component {
    render() {
        // 接收state参数
        const { id, title } = this.props.location.state || {}


        //接收params参数
        //const { id, title } = this.props.match.params

        // 接收search参数
        //const { search } = this.props.location
        //const { id, title } = qs.parse(search.slice(1))
        const findResult = DetailData.find((current) => {
            return current.id === id
        }) || {}
        console.log(findResult);
        return (
            <div>
                <ul>
                    <li>ID:{id}</li>
                    <li>Title:{title}</li>
                    <li>Content:{findResult.content}</li>
                </ul>
            </div>
        )
    }
}
